const app = getApp();
const {
  getOrderInfo,
  getUserLevel
} = require('../../../../api/api.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    orderInfoData: {},
    imgHost: '',
    userLevel: null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      imgHost: app.img_host,
    })
    //获取用户vip等级
    getUserLevel().then(res => {
      console.log("用户vip等级")
      console.log(res)
      this.setData({
        userLevel: res.level
      })
    })

    //获取到传递过来的订单号
    const ORDER_NUM = app.id
    console.log("传递过来的订单号")
    console.log(ORDER_NUM)
    getOrderInfo(ORDER_NUM).then(res => {
      console.log(res)
      this.setData({
        orderInfoData: res.data
      })
    }).catch(err => {
      console.log(err)
    })
  }
})